<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>w3导航条</title>
    <link rel="stylesheet" href="../CSS_Layout/CSS/reset.css">
    <style>

        body{
            height: 2000px;
        }
        .nav{
            width: 1210px;
            height: 48px;
            background-color: #e8e7e3;

            margin: 100px auto;
            /* 开起粘滞定位 */
            position: sticky;
            top: 0;
        }

        .nav li{
            float: left;
            /* background-color: red; */
            /* 垂直居中 */
            line-height: 48px;

        }

        .nav a{
            text-decoration: none;
            color: #777;
            font-size: 18px;
            display: block;
            /* width: 150px; */
            padding: 0 33px;
        }

        .nav li:last-child a{
            padding: 0 37px 0 38px;
        }
        .nav a:hover{
            background-color: #3f3f3f;
            color: #e8e7e3;
        }

       
    </style>
</head>
<body>
    <ul class="nav">
        <li>
            <a href="#">HTML/CSS1</a>
        </li>
        <li>
            <a href="#">HTML/CSS2</a>
        </li>
        <li>
            <a href="#">HTML/CSS3</a>
        </li>
        <li>
            <a href="#">HTML/CSS4</a>
        </li>
        <li>
            <a href="#">HTML/CSS5</a>
        </li>
        <li>
            <a href="#">HTML/CSS6</a>
        </li>
        <li>
            <a href="#">HTML/CSS7</a>
        </li>
    </ul>
    
</body>
</html>